#pragma once
#include <stack>
#include <vector>
#include "wfx.h"
#include "Code.h"
#include "TerminateToken.h"
#include "ScannerRule.h"

MAKE_PTR(CScanner);

class CScanner
{
public:
    static CScannerPtr create(CScannerRulePtr pScannerRule)
    {
        return CScannerPtr(new CScanner(pScannerRule));
    }
public:
    CScanner(CScannerRulePtr pScannerRule);
	~CScanner();


    CTerminateTokenPtr GetToken();
    CTerminateTokenPtr PeekToken(unsigned int index = 0);

    void PushCode(CCodePtr pCode);
    void PopCode();



private:
    std::stack<CCodePtr> m_CodeStack;
    std::vector<CTerminateTokenPtr> m_TokenCache;
	CScannerRulePtr m_pScannerRule;
};


